package com.jianggy.objects;

import java.util.Objects;

/**
 * @author jianggy
 * @version 1.0
 * @time 2019/6/4 10:46
 * @see
 **/
public class ObjectsTest {
    public static void main(String[] args){
        System.out.println(equalTest(null,null));
        System.out.println(hashTest("a","b","c"));
        System.out.println(hashTest("a","b","c"));
        System.out.println(toStringTest(new ObjectsTest()));
        System.out.println(toStringTest(null));
        System.out.println(nonullTest(null));
    }


    public static boolean equalTest(Object a,Object b){
        boolean res = Objects.equals(a,b);
        return res;
    }

    public static int hashTest(String...values){
        int res = Objects.hash(values);
        return  res;
    }

    public static String toStringTest(Object obj){
       return Objects.toString(obj,"the object is null");
    }

    public static Object nonullTest(Object obj){
        Object res = Objects.requireNonNull(obj,"the obj is null which is not allowed");
        return res;
    }

}
